Cart.vue =>
    products =>
        store.getters.cartProducts =>
            state.cart.added =>
                types.ADD_TO_CART来向added添加数据


ProductList.vue =>
    products =>
        store.products.actions.getAllProducts =>
            shop.getProducts =>
                types.RECEIVE_PRODUCTS =>
                    state.all = products 通过mutations向state.all添加数据


    click =>
        addToCart(p) =>  p in products
            store.actions.addToCart =>
                addToCart = ({ commit }, product) => {
                    if (product.inventory > 0) {
                        commit(types.ADD_TO_CART, {
                            id: product.id
                        })
                    }
                }

                [types.ADD_TO_CART] (state, { id }) {
                    state.all.find(p => p.id === id).inventory --
                }







created: this.$store.dispatch('getAllProducts')


getters: products

    allProducts => => state.all






addToCart
    actions: commit(ADD_TO_CART)
    mutations: ADD_TO_CART: commit(state,obj) => store.ProductList.state.all.inventory --
                            commit(state,obj) => store.cart.state.added.push
























